<template>
  <el-dialog :visible.sync="visible" title="案件详情" :close-on-click-modal="false" :close-on-press-escape="false">
    <el-form :model="dataForm" ref="dataForm"
      :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
      <el-form-item label="案件描述" prop="title">
        <el-input type="textarea" :readonly=true v-model="dataForm.content" placeholder="案件描述"></el-input>
      </el-form-item>
      <el-form-item label="图片证据" prop="content">
        <el-image v-for="url in dataForm.imgUrlLists" :key="url" :src="url" lazy></el-image>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        id: '',
        title: '',
        content: '',
        status: '',
        registerStatus: '',
        creator: '',
        createDate: '',
        updater: '',
        updateDate: ''
      }
    }
  },
  methods: {
    init() {
      this.visible = true
      this.$nextTick(() => {
        this.$refs['dataForm'].resetFields()
        if (this.dataForm.id) {
          this.getInfo()
        }
      })
    },
    // 获取信息
    getInfo() {
      this.$http.get(`/police/policereport/${this.dataForm.id}`).then(({ data: res }) => {
        if (res.code !== 0) {
          return this.$message.error(res.msg)
        }
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
      }).catch(() => { })
    }
  }
}
</script>
